package edu.online.dal;

import edu.online.entity.SwitchStudentEntity;
import org.apache.ibatis.jdbc.SQL;

public class SwitchStudentEntitySqlProvider {

    public String insertSelective(SwitchStudentEntity record) {
        SQL sql = new SQL();
        sql.INSERT_INTO("switchstudent");
        
        if (record.getSwitchstudent() != null) {
            sql.VALUES("SwitchStudent", "#{switchstudent,jdbcType=CHAR}");
        }
        
        if (record.getLessonscheduleid() != null) {
            sql.VALUES("LessonScheduleID", "#{lessonscheduleid,jdbcType=CHAR}");
        }
        
        if (record.getSwitchorderid() != null) {
            sql.VALUES("SwitchOrderID", "#{switchorderid,jdbcType=CHAR}");
        }
        
        if (record.getStudentid() != null) {
            sql.VALUES("StudentId", "#{studentid,jdbcType=CHAR}");
        }
        
        if (record.getIsapplier() != null) {
            sql.VALUES("IsApplier", "#{isapplier,jdbcType=BIT}");
        }
        
        if (record.getLessonschedule() != null) {
            sql.VALUES("LessonSchedule", "#{lessonschedule,jdbcType=CHAR}");
        }
        
        return sql.toString();
    }

    public String updateByPrimaryKeySelective(SwitchStudentEntity record) {
        SQL sql = new SQL();
        sql.UPDATE("switchstudent");
        
        if (record.getLessonscheduleid() != null) {
            sql.SET("LessonScheduleID = #{lessonscheduleid,jdbcType=CHAR}");
        }
        
        if (record.getSwitchorderid() != null) {
            sql.SET("SwitchOrderID = #{switchorderid,jdbcType=CHAR}");
        }
        
        if (record.getStudentid() != null) {
            sql.SET("StudentId = #{studentid,jdbcType=CHAR}");
        }
        
        if (record.getIsapplier() != null) {
            sql.SET("IsApplier = #{isapplier,jdbcType=BIT}");
        }
        
        if (record.getLessonschedule() != null) {
            sql.SET("LessonSchedule = #{lessonschedule,jdbcType=CHAR}");
        }
        
        sql.WHERE("SwitchStudent = #{switchstudent,jdbcType=CHAR}");
        
        return sql.toString();
    }
}